#ifndef CONNECTOR_H
#define CONNECTOR_H

#include <defs/export.h>
#include <defs/global.h>

#include <core/entityobject.h>
#include <QSettings>
#include <log4qt/logger.h>
#include "common.h"

namespace Opl
{
	namespace Helpers
	{


		O_PRIVATE_DECLARE(Connector);
		class HELPERS_EXPORT Connector : public Opl::Core::EntityObject
		{
				Q_OBJECT
				LOG4QT_DECLARE_QCLASS_LOGGER
			public:

				Connector(Opl::Core::EntityObject* parent = 0);
				virtual ~Connector();
				void Setup (const ConnectorSetup& setup);

				void Send(const QString& data);

				void Start();
				void Stop(bool force = false);

			signals:
				void output(const QString& data);
				void connected();
				void disconnected();
				void error();

			private slots:
				void threadConnected();
				void threadDisconnected();
				void threadOutput(const QString& data);

			private:
				O_PRIVATE_DECLARE_MEMBER(Connector);
		};

	}
}


#endif // CONNECTOR_H

